<template>
    <div class="demo">
        <h2>姓名：{{name}}</h2>
        <h2>年龄：{{age}}</h2>
        <button @click="showPersonInfo">点我提示信息</button>
    </div>
</template>

<script>
    export default {
        name:'Person',
        data() {
            return {
                name:'张三',
                age:18
            }
        },
        methods: {
            showPersonInfo(){
                alert(this.name + '-' +this.age)
            }
        },
    }
</script>

<style scoped>
    .demo {
        background-color: orange;
        padding: 20px;
    }
</style>